package com.atguigu03.ex1;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class e {
    public static void main(String[] args) {
        List studentlist=new ArrayList();
        Scanner scanner=new Scanner(System.in);
        int a=0;
        while(true){

            System.out.println("1：继续输入  0：停止输入");
            a=scanner.nextInt();
            if(a==0){
                break;
            }else {
                System.out.print("输入姓名");
                String name=scanner.next();
                System.out.println();
                System.out.print("输入年龄");
                int age=scanner.nextInt();
                studentlist.add(new Student(name,age));
            }
        }
        for (Object obj:studentlist) {
            System.out.println(obj.toString());
        }
        scanner.close();
    }

}
